package cn.schoolwow.util.module.query.jsonarray.service;

import cn.schoolwow.quickflow.QuickFlowExecutor;
import cn.schoolwow.quickflow.flow.CompositeBusinessFlow;
import cn.schoolwow.util.module.query.jsonarray.flow.filter.*;
import cn.schoolwow.util.module.query.jsonarray.handler.FilterJSONArraySingleFlowListener;

public class FilterJSONArrayFlow implements CompositeBusinessFlow {
    @Override
    public void executeCompositeBusiness(QuickFlowExecutor quickFlowExecutor) {
        quickFlowExecutor.next(new SetFilterJSONArrayFlow())
                .next(new CompositeBusinessFlow() {
                    @Override
                    public void executeCompositeBusiness(QuickFlowExecutor quickFlowExecutor) {
                        quickFlowExecutor.singleFlowListener(new FilterJSONArraySingleFlowListener())
                                .next(new FilterJSONArrayByFieldValueFlow())
                                .next(new FilterJSONArrayByFieldValueInListFlow())
                                .next(new FilterJSONArrayByFieldValueNotInListFlow())
                                .next(new SetUnderlineFieldFlow())
                                .next(new FilterJSONArrayByOrderByFieldNameFlow());
                    }

                    @Override
                    public String name() {
                        return "过滤JSON数组";
                    }
                });
    }

    @Override
    public String name() {
        return "根据指定条件过滤实例JSON数组";
    }
}
